package cn.school.thoughtworks.section3;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class PracticeC {
    Map<String,Integer> createUpdatedCollection(List<String> collectionA, Map<String,List<String>> object) {
        //实现练习要求，并改写该行代码。
        Map<String,Integer> collection3=new HashMap();
        for(int i=0;i<collectionA.size();i++){
            if(collection3.get(collectionA.get(i))!=null){
                Integer integer= (Integer) collection3.get(collectionA.get(i));
                integer++;
                collection3.put(collectionA.get(i),integer);
            }else {
                collection3.put(collectionA.get(i), 1);
            }
        }
        for (String s:collection3.keySet()){
            for(String x:object.get("value")){
                if (s.equals(x)){
                    Integer i = collection3.get(s);
                    int i1 = i / 3;
                    collection3.put(s,i-i1);
                }
                collection3.put(s,collection3.get(s));

            }

        }
        return collection3;
    }
}
